﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="UI.system.index" %>
<%@ Import Namespace="Model" %>
<%@ Import Namespace="Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title><%=config.WebName %></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <script src="/js/jquery.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/md5.js"></script>
    <script src="/js/swfupload.js"></script>
    <script src="/system/js/admin.js"></script>
    <script src="/system/layui/layui.js"></script>
    <link rel="stylesheet" href="/system/layui/css/layui.css">
    <link rel="stylesheet" href="/system/layui/css/global.css">
    <link rel="stylesheet" href="/system/css/iframe.css">
    <script type="text/javascript" src="/system/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="/system/ueditor/ueditor.all.min.js"> </script>
    <script type="text/javascript" src="/system/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header header header-demo">
            <div class="layui-main" style="margin-left:0px;">
                <a class="logo" href="/"><img src="<%=config.Logo %>"></a>
                <a class="name"><%=config.WebName %></a>
                <ul class="layui-nav">
                    <li class="layui-nav-item" style="margin-right:35px;"><a href="javascript:;"><%=admin.RealName%></a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:UpdatePwd()">修改密码</a></dd>
                            <dd><a href="/system/login.aspx?flag=loginout" onclick="LayerBox.Exist('正在退出，请稍后...')">退出</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
        </div>
        <div class="layui-side layui-bg-black">
            <div class="left">
                <ul class="layui-nav layui-nav-tree" lay-filter="demo">
                    <!-- 侧边导航: <ul class="layui-nav layui-nav-tree layui-nav-side"> -->
                    <%
                        int count = 0;
                        foreach(MenuInfo menu in parentlist){
                        count++;
                        List<MenuInfo> childlist = menulist.Where(x => x.ParentID == menu.ID).ToList();
                    %>
                    <li class="layui-nav-item <%=count==1?"layui-nav-itemed":"" %>"><a href="javascript:;" class="bigmenu"><%=menu.Name %></a>
                        <dl class="layui-nav-child">
                            <%foreach(MenuInfo child in childlist){%>
                            <dd data-id="tab-<%=child.ID %>" data-src="<%=child.Path %>"><a href="javascript:void(0);">&nbsp;&nbsp;<i class="layui-icon" style="top: 1px;">&#xe62d;</i> <font><%=child.Name %></font></a></dd>
                            <%} %>
                        </dl>
                    </li>
                    <%} %>
                </ul>
            </div>
        </div>
        <div class="layui-body site-demo" style="margin:0px; padding:0px;">
            <div class="layui-tab layui-tab-card" lay-allowclose="true" lay-filter="demo" style="border:0px; margin:0px; padding:0px; height:100%; overflow:hidden;">
              <ul class="layui-tab-title">
                <li class="layui-this" lay-id="11">控制面板</li>
              </ul>
              <div class="layui-tab-content" style="height:100%; overflow-y:hidden;margin:0px; padding:0px;">
                <div class="layui-tab-item layui-show">
                   <iframe id="iframe5" src="page/config/contact.aspx?id=tab-22"></iframe><div class="loading" id="tab-22">&nbsp;&nbsp;&nbsp;努力加载中...</div>
                </div>
              </div>
            </div>
        </div>
    </div>
    <iframe id="download" src="" style="width:0px; height:0px;"></iframe>
    </form>
    <script>
        function UpdatePwd() {
            Ajax.Get("/system/page/user/pwdupdate.html?v=1", function (html) {
                LayerBox.Show("修改密码",html, "500px", "300px", function (form) {
                    form.verify({
                        oldpwd: function (value) {
                            if (value == "") {
                                return '请输入旧密码';
                            }
                        },
                        newpwd: function (value) {
                            if (value == "") {
                                return '请输入新密码';
                            }
                        },
                        surepwd: function (value) {
                            if (value != $("#newpwd").val()) {
                                return '2次输入密码不一致';
                            }
                        }
                    });
                },
                function (form) {
                    var data = {};
                    data.act = "Update_Pwd";
                    data.oldpwd = form.oldpwd;
                    data.newpwd = form.newpwd;
                    data.sign = GetSign(data.act);
                    var index = LayerBox.Loading();
                    Ajax.Post("/tools/Admin.ashx", data, function (r) {
                        LayerBox.Close.ByIndex(index);
                        var json = $.parseJSON(r);
                        if (json.state) {
                            LayerBox.Success(json.msg, 500, function () {
                                LayerBox.Close.ByAll();
                            });
                        }
                        else {
                            LayerBox.Error(json.msg);
                        }
                    });
                });
            });

        };

        layui.config({
            base: 'layui/lay/modules/',
            version: new Date().getTime()
        }).use(['element', 'layer', 'form'], function () {
            var element = layui.element,
	            layer = layui.layer, table = layui.table ;
            $(".layui-nav-tree dd").click(function () {
                var src = $(this).data("src");
                var id = $(this).data("id");
                var title = $(this).find("font").html();
                if ($(".layui-tab li[lay-id='" + id + "']").length == 0) {
                    element.tabAdd('demo', {
                        title: title,
                        content: '<iframe src="' + src + '?id=' + id + '"></iframe><div class="loading" id="' + id + '">&nbsp;&nbsp;&nbsp;努力加载中...</div>',
                        id: id
                    });
                }
                element.tabChange('demo', id);
            });
        });
    </script>
</body>
</html>
